package org.xg.study.spring.al.config;

import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * @author CMG
 * @version 1.0
 * @description
 * @cLassName GlobalExceptionHandler
 * @date 2021/10/28 10:03
 **/
@RestControllerAdvice
@Slf4j
public class GlobalExceptionHandler extends BaseController {

    /**
     * 基础异常
     *
     * @param e
     * @return
     */
    @ExceptionHandler(RestException.class)
    public String baseException(RestException e) {
        return error(e.getRetCode(), e.getMessage());
    }
}
